<template>
	<view>
		<web-view :webview-styles="webviewStyles" :src="link"></web-view>
	</view>
</template>

<script>
	// import Vue from 'vue'
	import common from '@/common/script/common.js';
	export default {
		components: {

		},
		data() {
			return {
				link: "",
				webviewStyles: {
					progress: {
						color: '#007aff'
					}
				},
				title:'',
			}
		},
		async onLoad(options) {
			this.title = options.title
			let data = this.initNewData();
			console.log(options)
			data.location = 1;
			if (options.weburl != undefined && options.weburl != '' && options.weburl != null) {
				//this.url = options.weburl + "?data=" + encodeURIComponent(JSON.stringify(data));
				// console.log(options.weburl);
				// if (options.weburl.indexOf('?') > 0)
				// 	options.weburl = options.weburl + "&data=" + encodeURIComponent(JSON.stringify(data));
				// else
				// 	options.weburl = options.weburl + "?data=" + encodeURIComponent(JSON.stringify(data));
				
				if (options.weburl.indexOf('?') > 0){
					if(options.weburl.indexOf('m.bidcenter.com.cn')){
						let iswanshan = ''
						console.log(this.currUser.user_company)
						if( this.currUser.user_company !==''){
							iswanshan = 0
						}else{
							iswanshan = 1
						}
						options.weburl = options.weburl + "&token=" + data.token + "&from=" + data.from + '&guid=' + data.guid + '&iswanshan=' + iswanshan + '&location=' + 10895;
					}else{
						options.weburl = options.weburl + "&token=" + data.token + "&from=" + data.from;
					}
					
				}
					
				else
					options.weburl = options.weburl + "?token=" + data.token + "&from=" + data.from;
				    await this.init(options.weburl);
			} else {
				uni.showToast({
					title: "获取页面链接失败",
					icon: "none",
					success: function() {
						setTimeout(function() {
							uni.navigateBack({
								delta: 1
							});
						}, 2000)
					}
				});
			}

		},
		mounted() {
			//动态设置title
			
			uni.setNavigationBarTitle({
				title: this.title
			})
			
		},
		methods: {
			init(ur) {
				this.link = ur;
			}
		}
	}
</script>

<style lang="scss">

</style>
